home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 71 / MOBICLIC 71.ISO / mac / DATA / COMMUN / temp0001 / 00221_Script_SCRIPTS_GENE_JLM_01 < prev    next >
Text File  |  2004-12-05  |  66KB  |  1,989 lines

  1. --scripts gΘnΘraux pour Mobiclic nouvelle formule by ⌐Time line/jl moreau 2003,2004
  2. -------------------------------------------------
  3. on hide_title--obsolΦte
  4.   nothing
  5. end
  6. ----------------
  7. on LOAD_MOBIDATA
  8.   if the runMode = "author" and lien() = ":" then
  9.     importFileInto member("MOBIDATA"), "@//COMMUN/DATABASE/MOBIDATA.txt"
  10.     castLib("MOBI_MATOS").save()
  11.   end if
  12. end
  13. ------------------
  14. on SOSMIAW
  15.   global gL_Zap
  16.   temp = the windowlist.duplicate()
  17.   N = count(temp)
  18.   if N = 0 then exit
  19.   repeat with i = 1 to N
  20.     target = temp[i].name
  21.     window(target).close()
  22.     window(target).forget()
  23.     if target = "ZAPETTE"  then gL_Zap[2] = 0
  24.   end repeat
  25.   clearglobals()
  26. end
  27. -----------------------------------
  28. on goOtherRub  RUB, NoSousRub, ZELABEL
  29.   --envoie d'un dir d'une rubrique α un dir d'une autre rubrique
  30.   target = "@//"&RUB&"/"&RUB.char[1..4]&gimme2digits(NoSousRub)
  31.   case(the paramCount) of
  32.     2:-- on lance le dir α son dΘbut
  33.       go movie target
  34.     3:-- on envoie α un label du dir α l'ouverture
  35.       go ZELABEL of movie target
  36.   end case
  37. end
  38. ----------------
  39. on goSameRub SUFFIXE, ZELABEL
  40.   --envoie d'un dir d'une rubrique α un autre dir de la mΩme rubrique
  41.   target = "@/"&localparam("COORD",5)&gimme2digits(SUFFIXE)
  42.   case(the paramCount) of
  43.     1:
  44.       go movie target
  45.     2:
  46.       go ZELABEL of movie target
  47.   end case
  48. end
  49. -----------------------
  50. on sauteLabel MARQUEUR
  51.   --permet d'envoyer la tΩte de lecture α la frame suivant un label en enregistrant
  52.   --dans la globale gze_Label le pasage α ce label
  53.   global gze_Label
  54.   gze_Label = MARQUEUR
  55.   go label(MARQUEUR) + 1
  56. end
  57. ------------------
  58. on Jump00
  59.   u = zlast()
  60.   if  zNoSRub() = 1 and u.char[1..4] = zAbrev() and extractNo(u) <> 0 then go "ATTENTE"
  61. end
  62. ----------------
  63. on KURSOR NomCurseur
  64.   cursor[member(NomCurseur).number,member(NomCurseur&"_MASK").number]
  65. end
  66. ------------------
  67. on turndizstuff_Mob WADSPRITE, WADWAY
  68.   case(WADWAY) of
  69.     "ON":
  70.       if sprite(WADSPRITE).left >= 640 then sprite(WADSPRITE).locH = sprite(WADSPRITE).locH - 800
  71.     "OFF":
  72.       if sprite(WADSPRITE).left < 640 then sprite(WADSPRITE).locH = sprite(WADSPRITE).locH + 800
  73.   end case
  74. end
  75. ------------------------------------------------- 
  76. on turndizstuff  WADSPRITE, WADWAY
  77.   case(WADWAY) of
  78.     "ON":
  79.       if sprite(WADSPRITE).left >= 800 then sprite(WADSPRITE).locH = sprite(WADSPRITE).locH - 800
  80.     "OFF":
  81.       if sprite(WADSPRITE).left < 800 then sprite(WADSPRITE).locH = sprite(WADSPRITE).locH + 800
  82.   end case
  83. end
  84. ------------------------------------------------- 
  85. on TDS WADSPRITE, WADWAY
  86.   turndizstuff_Mob(WADSPRITE, WADWAY)
  87. end
  88. -------------------------
  89. on gimme2digits ZENOMBRE
  90.   case(ZENOMBRE) <10 of
  91.     1:
  92.       reponse = "0"&string(ZENOMBRE)
  93.     0:
  94.       reponse = string(ZENOMBRE)
  95.   end case
  96.   return reponse
  97. end
  98. -------------------------------------------------
  99. on tail ZESTRING, NbCHAR
  100.   L = length(ZESTRING)
  101.   return ZESTRING.char[L-NbCHAR + 1..L]
  102. end
  103. ---------------------------
  104. on but_tail ZESTRING, NbCHAR
  105.   L = length(ZESTRING)
  106.   return ZESTRING.char[1..L-NbCHAR]
  107. end
  108. -----------------------
  109. on cleanTail CHAINE
  110.   L = length(CHAINE)
  111.   u = L
  112.   repeat while CHAINE.char[u] = RETURN or CHAINE.char[u] = SPACE
  113.     U = U-1
  114.     CHAINE = CHAINE.char[1..U]
  115.   end repeat
  116.   return CHAINE
  117. end
  118. ---------------
  119. on gimmezeAlphabet_No WATCHAR
  120.   u = chartoNum(WATCHAR)
  121.   case(u>64 and u < 91) of
  122.     1:-- si c'est une capitale
  123.       reponse = u - 64
  124.     0:
  125.       case(u>96 and u < 123) of
  126.         1: -- si c'est une bas de casse
  127.           reponse = u - 96
  128.         0:
  129.           reponse = 0
  130.       end case
  131.   end case
  132.   return reponse
  133. end
  134. -----------------------------------
  135. on zLOWCASE MOT
  136.   fin = length(MOT)
  137.   reponse = EMPTY
  138.   repeat with i = 1 to fin
  139.     lettre = MOT.char[i]
  140.     code = charToNum(lettre)
  141.     if code <65 or code >90 then--si ca n'est pas une lettre majuscule
  142.       reponse = reponse&lettre---------------on pile la lettre
  143.     else---------------------------si c'est une majuscule
  144.       reponse = reponse&numToChar(code+32)---on pile la minuscule correspondante
  145.     end if
  146.   end repeat
  147.   return reponse
  148. end
  149. -----------------------
  150. on zCAPITAL MOT
  151.   fin = length(MOT)
  152.   reponse = EMPTY
  153.   repeat with i = 1 to fin
  154.     lettre = MOT.char[i]
  155.     code = charToNum(lettre)
  156.     if code <97 or code >122 then--si ca n'est pas une lettre minuscule
  157.       reponse = reponse&lettre---------------on pile la lettre
  158.     else---------------------------si c'est une minuscule
  159.       reponse = reponse&numToChar(code-32)---on pile la majuscule correspondante
  160.     end if
  161.   end repeat
  162.   return reponse
  163. end 
  164. -------------------
  165. on byte2Mega NbBYTES
  166.   return float(NbBYTES)/power(2,20)
  167. end
  168. ----------------------------------
  169. on JINGLE WATTRACK,WATSOUND, WATMODE
  170.   global gL_Zap
  171.   --joue un son du dossier JINGLES, soit en "direct from disk" (WATMODE = OUT),
  172.   --soit α partir de la distribution JINGLE (WATMODE = IN)
  173.   --avec ajustement des niveaux sonores
  174.   put "son jingle jouΘ:"& WATSOUND
  175.   case(WATMODE) of
  176.     "IN":
  177.       puppetSound WATTRACK, WATSOUND
  178.     "OUT":
  179.       sound playFile WATTRACK, "@//COMMUN/MOBI_JINGLES/"&WATSOUND&".aif"
  180.       repeat with i=1 to 8
  181.         if i<>WATTRACK and gL_Zap[16][i] > 110 then
  182.           sound(i).volume = 50
  183.         end if
  184.       end repeat
  185.   end case
  186. end
  187. -----------------------------------------
  188. on LOWJINGLE WATTRACK,WATSOUND, WATMODE
  189.   --joue un son du dossier JINGLES, soit en "direct from disk" (WATMODE = OUT),
  190.   --soit α partir de la distribution JINGLE (WATMODE = IN)
  191.   --sans ajustement des niveaux sonores
  192.   put "son jingle jouΘ:"& WATSOUND
  193.   case(WATMODE) of
  194.     "IN":
  195.       puppetSound WATTRACK, WATSOUND
  196.     "OUT","O":
  197.       sound playFile WATTRACK, "@//COMMUN/MOBI_JINGLES/"&WATSOUND&".aif"
  198.   end case
  199. end
  200. -----------------------------------------
  201. on gimmeQDraw_Center ZESPRITENo
  202.   --retourne le centre d'une forme QUICKDRAW situΘ sur la piste n░ ZESPRITENo
  203.   return point( (sprite(ZESPRITENo).right+sprite(ZESPRITENo).left )/2, (sprite(ZESPRITENo).Top + sprite(ZESPRITENo).Bottom)/2)
  204. end
  205. ----------------------------------------
  206. on locate_QDraw_bycenter ZESPRITENo, WATPLACE
  207.   -- positionne le centre d'un QuickDraw 
  208.   zedelta = point(sprite(ZESPRITENo).width/2, sprite(ZESPRITENo).height/2)
  209.   sprite(ZESPRITENo).loc = WATPLACE - zedelta
  210. end
  211. -----------------------------
  212. on lien 
  213.   if the platform contains "Win" then
  214.     reponse = "\"
  215.   else
  216.     reponse = ":"
  217.   end if 
  218.   return reponse
  219. end
  220. ------------------------
  221. on D10--renvoie 1 si la version du player est supΘrieure ou Θgale α celle de Director MX 2004 (version 10)
  222.   mem = the itemDelimiter
  223.   the itemDelimiter = "."
  224.   temp = the productVersion.item[1]
  225.   the itemDelimiter = mem
  226.   if value(temp) >= 10 then
  227.     return 1
  228.   else
  229.     return 0
  230.   end if
  231. end
  232. -----------------------
  233. on zOs
  234.   global gL_MOBIDATA
  235.   temp = gL_MOBIDATA[1][4]
  236.   case(lien()) of
  237.     ":":
  238.       the itemdelimiter = " "
  239.       plateforme = temp.item[1]
  240.       version = temp.item[3]
  241.     "\":
  242.       the itemdelimiter = ","
  243.       plateforme = temp.item[1]
  244.       version = temp.item[2]
  245.   end case
  246.   
  247.   case(plateforme) of
  248.     "Macintosh":
  249.       the itemdelimiter = "."
  250.       reponse = ["MAC",value(version.item[1])]--ex: ["Mac",10]
  251.     otherwise:
  252.       reponse = [plateforme,value(version)]--ex ["Windows XP",5]
  253.   end case
  254.   the itemdelimiter = ","
  255.   return reponse
  256. end
  257. -----------------------
  258. on ztitre ZUT
  259.   global gpisteTitre
  260.   case (ZUT) of
  261.     0:
  262.       sprite(gpisteTitre).member = "TITRE_NOP"
  263.     otherwise:
  264.       u = "TITRE_"&ZUT
  265.       sprite(gpisteTitre).member = u
  266.   end case
  267.   updateStage
  268. end
  269. -------------------------
  270. on zNoMobi
  271.   global  gL_MOBIDATA
  272.   return gL_MOBIDATA[1][1]
  273. end
  274. -----------------------
  275. on zRub
  276.   return string(localparam("COORD",1))
  277. end
  278. -----------------------
  279. on zNoRub
  280.   return localparam("COORD",2)
  281. end
  282. ---------------------
  283. on zfamily
  284.   return localparam("COORD",3)
  285. end
  286. -------------------
  287. on zNbSRub
  288.   return localparam("COORD",4)
  289. end
  290. ---------------
  291. on zAbrev
  292.   return localparam("COORD",5)
  293. end
  294. --------------------
  295. on zNoSRub
  296.   return localparam("COORD",6)
  297. end
  298. --------------
  299. on zRacine
  300.   return zAbrev()&gimme2digits(zNoSRub()-1)
  301. end
  302. ----------------------
  303. on zLast--renvoie le nom bref du dernier movie prΘcedemment ouvert ex "ARRI03"
  304.   global gL_Zap
  305.   if voidP( gL_Zap) then
  306.     return EMPTY
  307.   else
  308.     return  gL_Zap[11] 
  309.   end if
  310. end
  311. ----------------
  312. on zVolume NoPISTE
  313.   global gL_Zap
  314.   if voidP( gL_Zap) then
  315.     return EMPTY
  316.   else
  317.     return gL_Zap[16][NoPISTE]
  318.   end if
  319. end
  320. --------------------
  321. on zDumb
  322.   global gL_Zap
  323.   if voidP( gL_Zap) then
  324.     return EMPTY
  325.   else
  326.     return localparam("TOOLS","ZDUMB")
  327.   end if
  328. end
  329. --------------------
  330. on etatDumb
  331.   global gL_Zap
  332.   if voidP( gL_Zap) then
  333.     return EMPTY
  334.   else
  335.     return gL_zap[23]
  336.   end if
  337. end
  338. -----------
  339. on  zmemberName OBJ
  340.   reponse = sprite(OBJ.spriteNum).member.name
  341.   if tail(reponse,2) = "_R" then reponse = but_tail(reponse,2)
  342.   return reponse
  343. end
  344. -----------------------------
  345. on zRub_UserList  MODE -- envoie dans le container "USERS_TANK"(castLib "MOBI_MATOS")
  346.   global gScore_NomFic
  347.   --la liste des joueurs enregistrΘs dans le jeu de cette rubrique
  348.   --stockΘe sur le disque dur
  349.   case(the paramCount) of
  350.     0: --mode ancien( ex: quizz
  351.       gimme_userList("M"&string(zNoMobi())&string(zRub()),"USERS_TANK")
  352.     1:
  353.       case( param(1)) of
  354.         "SCORE":--module d'enregistrement de score
  355.           gimme_userList(gScore_NomFic,"USERS_TANK")
  356.         otherwise:
  357.           
  358.       end case
  359.       
  360.   end case
  361. end
  362. ----------------------------
  363. on zSaveRub_UsersList ZELIST
  364.   global glocalBUpath
  365.   pipeLine = new(xtra"fileio")-- crΘation d'une instance de l'Xtra File IO
  366.   --
  367.   fileName = glocalBUpath&"MOBICLIC"&lien()&"M"&string(zNoMobi())&string(zRub())&".txt"
  368.   -- crΘe le fichier
  369.   createFile (pipeLine, filename)
  370.   -- ouvre le fichier
  371.   openFile (pipeLine, filename, 0)
  372.   --dΘtruit le fichier deja existant
  373.   delete(pipeLine)
  374.   -- crΘe le fichier
  375.   createFile (pipeLine, filename)
  376.   -- ouvre le fichier
  377.   openFile (pipeLine, filename, 0)
  378.   -- Θcriture de l'acteur
  379.   pipeLine.writeString(string(ZELIST))
  380.   -- fermeture
  381.   closeFile(pipeLine)  
  382.   pipeLine = 0
  383. end
  384. --------------------
  385. on participe TARGET
  386.   global  gL_RetourCOUR, gPart_Target
  387.   gL_RetourCOUR = [string(zrub()),zNoSRub()]
  388.   gPart_Target = TARGET
  389.   goOtherRub("COURRIER",0)
  390. end
  391. --------------------
  392. on localParam SUJET, SOUS_SUJET-- SUJET prenant les valeurs "COORD", "NAV", "TOOLS" ou "MISC",SOUS_SUJET Θtant un entier ou "ALL"
  393.   global gL_localdata
  394.   case(SOUS_SUJET = "ALL") of
  395.     1:
  396.       return gL_localdata.getProp(SUJET)
  397.     0:
  398.       case(integerP(SOUS_SUJET)) of
  399.         1:          
  400.           return gL_localdata.getProp(SUJET)[SOUS_SUJET]
  401.         0:
  402.           return gL_localdata.getProp(SUJET).getProp(SOUS_SUJET)
  403.       end case
  404.   end case
  405. end
  406. -------------------------
  407. on COMMENT_TANK
  408.   reponse = "LOCAL_COMMENTS"
  409.   return reponse
  410. end 
  411. -------------------------------
  412. on windAuga VAR,NOMFEN
  413.   global gL_Zap
  414.   case(D10()) of
  415.     0:-------------------------------------- player crΘΘ avec une version < Director 10
  416.       VAR.windowType = member(NOMFEN&"_MASK")
  417.       VAR.modal = 0
  418.     1:-------------------------------------- player crΘΘ avec une version >=  Director 10
  419.       case(lien()) of
  420.         ":":--------------------------------------- on est sur un Mac
  421.           case(zOs()[2]>=10) of
  422.             1:------------------------------------------- on est sous OsX
  423.               VAR.appearanceOptions.mask = member(NOMFEN&"_MASK")
  424.               VAR.type = #tool
  425.               VAR.appearanceOptions.shadow = TRUE
  426.             0:------------------------------------------- on est sous Classic
  427.               VAR.appearanceOptions.mask = member(NOMFEN&"_MASK")
  428.               --              VAR.type = #tool
  429.               
  430.           end case
  431.         "\":--------------------------------------- on est sur un Pc
  432.           VAR.type = #tool
  433.           VAR.appearanceOptions.mask = member(NOMFEN&"_MASK")
  434.       end case
  435.   end case
  436. end
  437. ------------------------------
  438. on PATCH4_Os9 NOMFEN
  439.   if zOs()[1] = "MAC" and zOs()[2] < 10 then NOMFEN.moveToFront()
  440. end
  441. -------------------------------
  442. on show_RECRE NoRECRE
  443.   x0 = the stageLeft
  444.   y0 = the stageTop
  445.   ze_W = window("RECRE_TEMP")
  446.   ze_W.rect = rect(x0 + 74,y0 + 0, x0 + 566 ,y0 + 450)
  447.   ze_W.filename = "@/RECRE"&gimme2digits(NoRECRE)
  448.   windAuga(ze_W,"RECRE")
  449.   ze_W.title =EMPTY
  450.   ze_W.open()
  451. end
  452. ----------------------
  453. on show_ENCADRE NoENCADRE
  454.   x0 = the stageLeft
  455.   y0 = the stageTop
  456.   if D10() then window().new("ENCADRE_TEMP")
  457.   ze_W = window("ENCADRE_TEMP")
  458.   temp = "ENCADRE_"&gimme2digits(NoENCADRE)
  459.   demi_w = member(temp&"_MASK").width/2
  460.   demi_h = member(temp&"_MASK").height/2
  461.   ze_W.rect = rect(x0 + 320 - demi_w,y0 + 240 - demi_h, x0 + 320 + demi_w ,y0 + 240 + demi_h)
  462.   ze_W.filename = "@/ENCA_"&zAbrev()&gimme2digits(NoENCADRE)
  463.   windAuga(ze_W,temp)
  464.   ze_W.title =EMPTY
  465.   ze_W.open()
  466. end 
  467. ---------------------
  468. on show_COMMENTS TEMP --ouvre la fenΩtre commentaires
  469.   global gL_Zap
  470.   if gL_Zap[30] = 0 then member("DUMB_COMMENT").text = EMPTY
  471.   if gL_Zap[23]= 0 then-- la fenΩtre commentaires n'a pas encore ΘtΘ ni chargΘe, on charge la fenΩtre
  472.     x0 = the stageLeft
  473.     y0 = the stageTop
  474.     if D10() then window().new("COMMENTS")
  475.     gL_Zap[24] = window("COMMENTS")
  476.     gL_Zap[25] = [member("COMMENTS_MASK").width,member("COMMENTS_MASK").height]
  477.     rect_fen = rect(x0 + 2,y0 + 450, x0 +2 + gL_Zap[25][1],y0 + 450 + gL_Zap[25][2])
  478.     gL_Zap[24].rect = rect_fen
  479.     gL_Zap[26] = rect_fen
  480.     gL_Zap[24].filename = "@//COMMUN/MOBI_SOUSTITRAGE"
  481.     windAuga(gL_Zap[24],"COMMENTS")
  482.     gL_Zap[24].title =EMPTY
  483.   end if
  484.   case(gL_Zap[23]) of
  485.     0:-- la fenΩtre commentairesn'a pas encore ΘtΘ ni chargΘe no α fortiori ouverte 
  486.       gL_Zap[27] = rect_fen --memorisation de l'emplacement d'ouverture de la fenΩtre commentaires
  487.       gL_Zap[23]= 1
  488.       gL_Zap[24].open()
  489.     -1:-- la fenΩtre commentaires a ΘtΘ chargΘe mais elle est fermΘe actuellemnet
  490.       gL_Zap[23]= 1
  491.       gL_Zap[24].open()
  492.     1:---- fenΩtre commentaires est ouverte, on la rouvre α sa place initiale
  493.       --cela permet de la rΘcupΘrer quand elle est hors Θcran
  494.       gL_Zap[24].rect = gL_zap[26]
  495.       gL_zap[27] = gL_zap[26]
  496.   end case
  497.   tell gL_Zap[24]
  498.     sprite(1).member = "FD_COMMENT_"&gimme2digits(zfamily())
  499.     updatestage
  500.   end tell
  501. end
  502. -------------------------
  503. on show_zapette TEMP --ouvre la fenΩtre tΘlΘcommande
  504.   global gL_Zap
  505.   if gL_Zap[2]= 0 then-- la fenΩtre de la zapette n'a pas encore ΘtΘ ni chargΘe, on charge la fenΩtre
  506.     x0 = the stageLeft
  507.     y0 = the stageTop
  508.     if D10() then window().new("ZAPETTE")
  509.     gL_Zap[1] = window("ZAPETTE")
  510.     gL_Zap[4] = [member("ZAPETTE_MASK").width,member("ZAPETTE_MASK").height]
  511.     rect_zapette = rect(x0,y0 + 480 -gL_Zap[4][2], x0 + gL_Zap[4][1] ,y0 + 480)
  512.     gL_Zap[1].rect = rect_zapette
  513.     gL_Zap[5] = rect_zapette
  514.     gL_Zap[1].filename = "@//COMMUN/MOBI_ZAPETTE"
  515.     windAuga(gL_Zap[1],"ZAPETTE")
  516.     gL_Zap[1].title =EMPTY
  517.   end if
  518.   case(gL_Zap[2]) of
  519.     0:-- la fenΩtre de la zapette n'a pas encore ΘtΘ ni chargΘe ni α fortiori ouverte 
  520.       gL_Zap[6] = rect_zapette --memorisation de l'emplacement d'ouverture de la zapette
  521.       gL_Zap[2]= 1
  522.       gL_Zap[1].open()
  523.       
  524.     -1:-- la fenΩtre de la zapette a ΘtΘ chargΘe mais elle est fermΘe actuellement
  525.       gL_Zap[2]= 1
  526.       gL_Zap[1].open()
  527.       tell gL_Zap[1]
  528.         go "MAJ"
  529.       end tell
  530.     1:---- la fenΩtre de la zapette est ouverte, on la rouvre α sa place initiale
  531.       --cela permet de la rΘcupΘrer quand elle est hors Θcran
  532.       gL_Zap[1].rect = gL_zap[5]
  533.       gL_zap[6] = gL_zap[5]
  534.       tell gL_Zap[1]
  535.         go "MAJ"
  536.       end tell
  537.   end case
  538.   
  539. end
  540. ---------------------
  541. on refresh_zapette
  542.   global gL_Zap
  543.   if gL_Zap[1] = EMPTY then-- pour le mode auteur quand on ouvre directement n'importe quel dir
  544.     show_zapette()
  545.   else
  546.     --
  547.   end if
  548.   tell gL_Zap[1]
  549.     go "MAJ"
  550.   end tell
  551. end
  552. --------------------
  553. on MAJ_zapette--PROCEDURE DE RAFRAICHISEMENT DE LA ZAPETTE
  554.   global gL_localdata, gL_Zap, gL_mobidata,gL_localTEXTES
  555.   tell the stage
  556.     init_localTEXTES() 
  557.   end tell
  558.   if gL_Zap[2]= 0 then exit--si la fenΩtre de zappette n'est pas encore ouverte on passe
  559.   gL_Zap[3] = 1--on met α 1 le flag de mise α jour
  560.   NoStyle_zapette= gL_localdata[1][4]
  561.   --  MAJ du fond de la zapette
  562.   sprite(2).member = "FDZAP_"&gimme2digits(localparam("COORD",3))
  563.   --MAJ de la titraille--------------------------------------
  564.   if gL_localTEXTES =[] or voidP(gL_localTEXTES) then
  565.     member("TITRE_RUB").text = EMPTY
  566.   else
  567.     temp = gL_localTEXTES.getaProp("_TITRE")
  568.     if not(zRub() = "CPLUSCLAIR" and  zNoSRub() = 1) then
  569.       tell the stage
  570.         if member(COMMENT_TANK()).text = EMPTY then member("TITRE_RUB").text = EMPTY
  571.         u =  member(COMMENT_TANK()).char[temp[1]..temp[2]]
  572.         if not(voidP(u)) then
  573.           member("TITRE_RUB").text =u
  574.         end if
  575.         member("TITRE_RUB").fontSize = 9
  576.       end tell
  577.     end if
  578.   end if
  579.   --MAJ des boutons de navigation-----------------------------------
  580.   L1 = ["ZNEXT", "ZPREV","ZBEGIN","ZAGAIN","ZPAUSE"]
  581.   temp = localParam("NAV", "ALL")
  582.   repeat with i = 1 to count(L1)
  583.     puppetSprite sprite(gL_Zap[7][i]), FALSE
  584.     if temp.getProp(L1[i]) = -1 then
  585.       sprite(gL_Zap[7][i]).blend = 20
  586.     else
  587.       sprite(gL_Zap[7][i]).blend = 100
  588.     end if
  589.   end repeat
  590.   --MAJ des boutons des utilitaires
  591.   L1 = ["ZHELP","ZDICO","ZINFO","ZDUMB","ZAPHELP"]
  592.   temp = localParam("TOOLS", "ALL")
  593.   repeat with i = 1 to count(L1)
  594.     puppetSprite sprite(gL_Zap[8][i]), FALSE
  595.     if temp.getProp(L1[i]) = -1 then
  596.       sprite(gL_Zap[8][i]).blend = 20
  597.     else
  598.       sprite(gL_Zap[8][i]).blend = 100
  599.     end if
  600.   end repeat
  601.   --MAJ des boutons MISC
  602.   ---------bouton coupe musique
  603.   case(gL_Zap[17]) of
  604.     1:
  605.       --      sprite(gL_Zap[19][4]).member = "BTON_MUSIK_OFF"
  606.       sprite(46).member = "BTON_MUSIK_OFF"
  607.     0:
  608.       --      sprite(gL_Zap[19][4]).member = "BTON_MUSIK_ON"
  609.       sprite(46).member = "BTON_MUSIK_ON"
  610.   end case
  611.   --------VuMETRE
  612.   --  sprite(gL_Zap[19][3]).member = "VU"&gimme2digits(gL_Zap[16][9])
  613.   sprite(45).member = "VU"&gimme2digits(gL_Zap[16][9])
  614.   ---------DIODES
  615.   NbEcrans = localParam("COORD",4) --on rΘcupΦre le nombre de dirs de la rubrique
  616.   repeat with i = 1 to 12-----------on rend visibles seulement les diodes associΘes aux Θcrans de la rubrique
  617.     u = gL_zap[15] + i -1
  618.     if i <= NbEcrans then
  619.       sprite(u).blend = 100
  620.     else
  621.       sprite(u).blend = 0
  622.     end if
  623.   end repeat
  624.   
  625.   NoRub = gL_mobiDATA[3].getPos(zabrev())
  626.   temp = gimmeDATA([4 + 2*NoRub])[1]
  627.   repeat with i = 1 to NbEcrans --masquage des diodes associΘes aux Θcrans rendus non accessibles
  628.     u = gL_zap[15] + i -1
  629.     case(temp[i].getProp("MISC").getprop("ZCLICDIODE")) of
  630.       -1:
  631.         sprite(u).blend = 0
  632.       1:
  633.         sprite(u).blend = 100
  634.     end case
  635.   end repeat
  636.   
  637.   --  sprite(gL_Zap[15] + 12).left = sprite(gL_Zap[15] + NbEcrans -1).right--ajustement du masque de diodes pour faire apparitre le nombre exact de diodes
  638.   fin = localParam("COORD",4)
  639.   temp = gL_mobidata[4][localParam("COORD",2)-1]
  640.   repeat with i = 1 to fin
  641.     u = gL_zap[15] + i -1
  642.     if temp[i] = 1 then -- si le dir a dΘja ΘtΘ ouvert on illumine la diode correspondante dans la zapppette
  643.       sprite(u).member = "DIODE_ON"
  644.     else------------------ si le dir n'a pas dΘja ΘtΘ ouvert on Θteint la diode correspondante dans la zapppette
  645.       sprite(u).member = "DIODE_OFF"
  646.     end if
  647.   end repeat
  648.   ---------triangle pointeur
  649.   No = localParam("COORD",6)
  650.   flag = localParam("MISC",3)
  651.   if flag = 1 then--si la diode est cliquable
  652.     sprite(18).loc = point(18 + 28*(No-1 - 6*((No-1)/6)), 120 +30*((No-1)/6))--on place le triangle
  653.     
  654.   else--------------sinon on le fait disparaitre
  655.     puppetSprite 18,FALSE
  656.   end if
  657.   updateStage
  658.   --MAJ du logo de rubrique
  659.   if zRacine() <> "COUR00" and  zRacine() <> "AIDE00"then
  660.     sprite(1).member = "logo"&localparam("COORD",5)
  661.   end if
  662.   ------
  663.   updatestage
  664.   gL_Zap[3] = 0--on met α 0 le flag de mise α jour
  665.   tell the stage
  666.     put "Fin de la MAJ de la zapette"
  667.   end tell
  668. end
  669. ---------------------------------------------------------------------------------------------------------
  670. on RAZ_Zap_params
  671.   global gL_Zap
  672.   gL_Zap = [EMPTY,0,0,[0,0],rect(0,0,0,0),rect(0,0,0,0),[],[],EMPTY,0,EMPTY,0,[0,0],0,0,\
  673. [150,200,255,255,255,255,255,100,6],1,1,[],1,1,1,0,EMPTY,[0,0],rect(0,0,0,0),rect(0,0,0,0),0,[0,0],0]
  674.   --1) nom de la fenΩtre zap
  675.   --2) flag ouverture zapette
  676.   --3) flag maj de la zapette
  677.   --4) [largeur zapette, hauteur zapette]
  678.   --5) rect de la fenΩtre zapette α sa premiΦre apparition
  679.   --6) rect actuel de   la fenΩtre zapette
  680.   --7) liste des pistes des boutons de navigation de la zapette
  681.   --8) liste des pistes des boutons utilitaires de la zapette
  682.   --9) label sous-module dans la fenΩtre zapette
  683.   --10) flag de pause
  684.   --11) dernier movie ouvert
  685.   --12) flag de saisie de la barre de dΘplacement de la fenΩtre zapette
  686.   --13) vecteur de dΘcalage entre le point de cette saisie et le coin HG de cette fenΩtre zap
  687.   --14) n░ de piste du fond de la zapette
  688.   --15) n░ de piste des diodes
  689.   --16) liste des intensitΘs des pistes sons + niveau gΘnΘral(de 1 α 6)
  690.   --17) flag de valide musique
  691.   --18) flag de valide raccourcis
  692.   --19) liste des pistes des boutons MISC de la zapette
  693.   --20) flag d'interactivitΘ des diodes (par dΘfaut α 1); peut Ωtre modifiΘ par diode(u) o∙ vaut 1 ou 0
  694.   --21) n░ piste bandeau du bas dans le dir principal(par dΘfaut α 1 mais mis α jour on beginsprite du bandeau
  695.   --22) flag d'importation des textes locaux
  696.   --23) flag d'ouverture fenΩtre commentaires
  697.   --24) nom de la fenΩtre commentaires
  698.   --25) dimensions de la fenΩtre commentaires
  699.   --26) position initiale de la fenΩtre commentaires
  700.   --27) position actuelle de la fenΩtre commentaires
  701.   --28) flag mode de la fenΩtre commentaires
  702.   --29) vecteur de dΘcalage entre le point de cette saisie et le coin HG de cette fenΩtre commentaires
  703.   --30) flag de lancement de son commentaire α afficher
  704. end
  705. ---------------------------
  706. on prepare_Rub
  707.   global glocal_Folder, gRacine, gL_mobiDATA, gL_localdata, gL_Zap, gL_sRubTitres
  708.   global gL_localTEXTES
  709.   if D10() then
  710.     (the stage).appearanceOptions.mask = member("STAGE_MASK")
  711.     (the stage).type = #document
  712.   end if
  713.   if voidP(gL_Zap) then RAZ_Zap_params()
  714.   if gL_Zap[11] = "CPLU00" then
  715.     Flagcoupegmusik = 0
  716.   else
  717.     coupeson(1)
  718.     Flagcoupegmusik = 1
  719.   end if
  720.   repeat with i = 1 to 10
  721.     temp = sprite(i).scriptList
  722.     fin = count(temp)
  723.     repeat with j = 1 to fin
  724.       if temp[j][1].name contains "BANDEAU_MOBICLIC" then
  725.         sprite(i).locZ = 3000 + i
  726.         exit repeat
  727.       end if
  728.     end repeat
  729.   end repeat
  730.   --  the alertHook = script "ALERT_JLM"
  731.   --1)--------------------------------------MAJ DES CHEMINS DE RECHERCHE DES FICHIERS--------------------
  732.   the searchPaths = ["@//COMMUN","@//COMMUN/MUSIK"]
  733.   --2)--------------------------------------MAJ DE LA LISTE DES PARAMETRES GENERAUX------------------------
  734.   if voidP(gL_mobiDATA) then
  735.     gL_mobiDATA =  gimmeDATA([2,4])--gL_mobiDATA = [paramΦtres du No actuel,liste des rubriques avec le n░ de famille,le nombre d'items dans zapette,le titre dans zapette]
  736.     if D10() then
  737.       gL_mobiDATA[1].add(_system.environmentPropList.getProp("osVersion"))--on ajoute l'OS et sa version
  738.     else
  739.       gL_mobiDATA[1].add("NOP")
  740.     end if
  741.     NbRub = count(gL_mobiDATA[2])-1
  742.     gL_mobiDATA[1].add(NbRub)--on ajoute aux paramΦtres du no le nombre de rubriques y compris le sommaire (sauf l'intro, le courrier
  743.     -- et l'aide mobiclic)
  744.     L = []
  745.     --    repeat with i = 1 to NbRub+1
  746.     repeat with i = 1 to NbRub + 1
  747.       L.add(string(gL_mobiDATA[2].getPropAt(i)).char[1..4])
  748.     end repeat
  749.     gL_mobiDATA.add(L)
  750.     --crΘation de la liste de navigation de l'utilisateur
  751.     L1 = []
  752.     repeat with i = 1 to NbRub
  753.       L2 = []
  754.       u = i+1--dΘcalage α cause de l'intro qu'on ne compte pas
  755.       fin = count(gimmeDATA([4 + 2*u])[1])-- car mobidata renvoie [[....]]); on compte le nombre d'Θcrans par rubrique
  756.       repeat with j = 1 to  fin
  757.         L2.add(0)
  758.       end repeat 
  759.       L1.add(L2)
  760.     end repeat
  761.     gL_mobiDATA.add(L1)
  762.     --gL_mobiDATA = [params du No actuel,liste des rubs avec n░ de famille, liste des noms gΘnΘriques des .dir des rubs,liste navigation]
  763.     --MAJ du popMenu des rubriques dans la zapette------------------
  764.     L_inactifs = gL_Mobidata[1][3]-- on extrait la liste des rubriques inactives du mois
  765.     LtitresRoll = value(member("TITRES_ROLL_ZAPETTE").line[1])-- on extrait la liste des titres en roll des accΦs rubriques dans la zapette
  766.     debut = 3-----------------------on exclut INTRO et RATOCLIC
  767.     fin = count(gL_mobiDATA[2])-2 --on exclut COURRIER et AIDE
  768.     ListeTitres = EMPTY-- on initialise la variable dans la quelle on va piler les libellΘs des accΦs rubriques pour le popMenu
  769.     L3 = []--on initialise la liste des accΦs rubriques
  770.     repeat with i = debut to fin
  771.       zeprop = gL_mobiDATA[2].getpropAt(i)
  772.       if L_inactifs.getPos(value(zeprop)) = 0 then
  773.         Lvaleurs = gL_mobiDATA[2].getprop(zeprop)
  774.         NbItems = Lvaleurs[2]--on lit le nombre d'items de la rubrique figurant dans le popMenu
  775.         case(NbItems) of
  776.           1:-- s'il n'y a qu'un seul point d'accΦs α la rubrique
  777.             temp = Lvaleurs[3]
  778.             tampon = LtitresRoll.getProp(zeprop)
  779.             L3.add([string(zeprop),tampon])--on ajoute α la liste [le nom abrΘgΘ de celle-ci,le titre roll] (ex: [.....,["TOUT", "La pΩche α la sardine"]]
  780.           otherwise:-- s'il y a plusieurs point d'accΦs α la rubrique
  781.             temp = EMPTY
  782.             u = Lvaleurs[3]
  783.             repeat with j = 1 to NbItems
  784.               tampon = LtitresRoll.getProp(zeprop&string(j))
  785.               temp = temp&u&&string(j)
  786.               L3.add([string(zeprop),j,tampon])--on ajoute α la liste le nom abrΘgΘ de celle-ci,le n░ d'accΦs,le titre roll] ex: [.....,["ARRIBA",2, "Le jeu du con"]]
  787.               if j < NbItems then temp = temp&RETURN
  788.             end repeat
  789.         end case
  790.         ListeTitres = ListeTitres&temp
  791.         if i < fin then ListeTitres = ListeTitres&RETURN
  792.       end if
  793.     end repeat
  794.     member("TITRES_RUBRIQUES").text = ListeTitres -- on remplit le popmenu
  795.     gL_mobiDATA.add(L3)
  796.     --gL_mobiDATA = [params du No actuel,liste des rubs avec n░ de famille, liste des noms gΘnΘriques des .dir des rubs,liste navigation,liste des acces rubriques du popmenu]
  797.   end if
  798.   --3)--------------------------------------MAJ DE LA LISTE DES PARAMETRES LOCAUX------------------------
  799.   glocal_Folder = gimmeMyFolder()-- on extrait le nom du dossier courant
  800.   temp = the movieName
  801.   L = length(temp)
  802.   gRacine = CLEANLOWCASE(temp.char[1..L-4])-- on extrait la partie utile du nom du fichier par exemple "BIDU02" dans "BIDUO2.dir"
  803.   ABREV = gRacine.char[1..4]
  804.   NoRub = gL_mobiDATA[3].getPos(ABREV)--on extrait le n0 de la rubrique dans la liste
  805.   --par exemple "BIDU02.dir" fait partie de la 3Φme rubrique (dans la liste ["BACS", "BIBLIO", "BIDULE",.....]
  806.   NomRub = gL_mobiDATA[2].getPropAt(NoRub)
  807.   NoFamille = gL_mobiDATA[2].getprop(NomRub)[1]
  808.   NoEcran = extractNo(gRacine) + 1 -- par exemple "BIDU00.dir" donne 0+ 1 => 1er movie de la rubrique
  809.   temp = gimmeDATA([4 + 2*NoRub])[1]-- car mobidata renvoie [[....]]
  810.   NbEcrans = count(temp)
  811.   gL_localdata = temp[NoEcran]
  812.   gL_localdata.addProp(#COORD,[NomRub,NoRub,NoFamille,NbEcrans,ABREV,NoEcran])
  813.   -- on rajoute [la partie gΘnΘrique des noms des movies de la rubrique, le No de movie dans la rubrique, le n░ de la rubrique, sa famille, le nb de dir, le nom abrΘgΘ, le n░ de dir courant]]
  814.   put "Fin de la MAJ des paramΦtres locaux du movie "&the movieName
  815.   
  816.   --4)--------------------------------------MAJ DE LA GESTION DE LA ZAPETTE-------------------------------
  817.   
  818.   if gRacine  = "RATO00" then--α l'ouverture du sommaire on force l'apparition de la zapette
  819.     if gL_Zap[2] = 0 then
  820.       show_zapette()
  821.     else
  822.       refresh_zapette
  823.     end if
  824.   else
  825.     refresh_zapette
  826.   end if
  827.   --5)--------------------------------------MAJ DE LA GESTION LOCALE DES TOUCHES DE RACCOURCIS------------
  828.   case(localParam("MISC","ZSHORTCUTS")) of
  829.     1:
  830.       touchesOn()
  831.     -1:
  832.       touchesOff()
  833.   end case
  834.   --6)---------------------------------------MAJ DE LA GESTION DU SON
  835.   niveauSon()
  836.   --7)---------------------------------------LANCEMENT DE LA MUSIQUE D'AMBIANCE---------------------------
  837.   case(Flagcoupegmusik) of
  838.     0:
  839.       nothing
  840.     1:
  841.       fin = the number of members of castLib(1)
  842.       temp = "MUSIK_"&gRacine
  843.       repeat with i = 1 to fin
  844.         if member(i).name = temp then
  845.           puppetSound(1,"MUSIK_"&gRacine)
  846.           exit repeat
  847.         end if
  848.       end repeat
  849.   end  case
  850.   --8)---------------------------------------MAJ DES TITRES BANDEAUX
  851.   --  fin = the number of members of castLib(1)
  852.   --  temp = "LOCAL_TITRES"
  853.   --  repeat with i = 1 to fin
  854.   --    if member(i).name = temp then
  855.   --      gL_sRubTitres = []
  856.   --      EOL = member("LOCAL_TITRES").line.count
  857.   --      repeat with j = 1 to EOL
  858.   --        gL_sRubTitres.add(member("LOCAL_TITRES").line[j])
  859.   --      end repeat
  860.   --      exit repeat
  861.   --    end if
  862.   --  end repeat
  863.   
  864.   --9)---------------------------------------MAJ DU FOND DE LA FENETRE COMMENTS SI ELLE A DEJA ETE OUVERTE
  865.   if gL_Zap[23] <> 0 then-- si la fenΩtre est visible(1) ou invisible(-1)
  866.     tell gL_Zap[24]
  867.       sprite(1).member = "FD_COMMENT_"&gimme2digits(zfamily())
  868.       updatestage
  869.     end tell
  870.   end if
  871.   --10)-------------------------------------MAJ des containers en cas d'utilisation d'une DB d'utilisateurs
  872.   if zNoSRub() = 1 then--si on dΘbute la rubrique ( XXXX00.dir)
  873.     member("USER_SELECTION").text = EMPTY
  874.     member("USERS_TANK").text = EMPTY
  875.   end if
  876. end
  877. -----------------------------------------------------------------------------------------------------------
  878. on close_Rub
  879.   global gL_Zap, gRacine, gL_sRubTitres,gZ_pisteTitre 
  880.   --member("LOCAL_TEXTES").text = EMPTY
  881.   inscription()
  882.   gL_sRubTitres = VOID
  883.   RAZ_pistes_son()
  884.   temp = the windowlist.duplicate()--fermeture des fenΩtres locales
  885.   if temp <> [] then
  886.     N = count(temp)
  887.     repeat with i = 1 to N
  888.       nomfen = temp[i].name
  889.       if tail(nomfen, 5) = "_TEMP"  then
  890.         window(nomfen).close()
  891.         window(nomfen).forget()
  892.       end if
  893.     end repeat
  894.   end if
  895.   if the runMode = "Author" then
  896.     gL_Zap[1].close()
  897.     gL_Zap[1].forget()
  898.     gL_Zap[2] =0
  899.     case(gL_Zap[23]) of
  900.       -1:
  901.         gL_Zap[24].forget()
  902.       1:
  903.         gL_Zap[24].close()
  904.         gL_Zap[24].forget()
  905.     end case
  906.     gL_Zap[23] = 0
  907.   end if
  908.   gL_Zap[11] = gRacine
  909.   gZ_pisteTitre = VOID
  910. end
  911. --------------------------
  912. on inscription--permet de marquer la visite de ce dir dans la liste de navigation
  913.   global gL_mobidata
  914.   gL_mobidata[4][localparam("COORD",2)-1][localparam("COORD",6)] = 1--le "-1" car on ne liste pas l'intro
  915. end
  916. --------------------------
  917. on gimmeDATA LISTE_LIGNES
  918.   --ANCIENNE VERSION-----------------------------------------------------------------
  919.   --  pipeLine = new(xtra"fileio")-- cration d'une instance de l'Xtra File IO
  920.   --  temp = "@//COMMUN/DATABASE/MOBIDATA.txt"
  921.   --  if not voidP(temp) and not (temp = EMPTY) then
  922.   --    openFile(pipeLine, temp, 1)--ouverture du fichier
  923.   --    if status(pipeLine) = 0 then
  924.   --      tampon = readFile(pipeLine)
  925.   --      reponse = []
  926.   --      repeat with i in LISTE_LIGNES
  927.   --        reponse.add(value(CLEANLOWCASE(tampon.line[i])))
  928.   --      end repeat
  929.   --    else
  930.   --      alert error (pipeLine, status(pipeLine))
  931.   --      reponse = [-1]
  932.   --    end if
  933.   --  end if
  934.   --  closeFile(pipeLine)
  935.   --  pipeLine = 0
  936.   --NOUVELLE VERSION------------------------------------------------------------
  937.   reponse = []
  938.   repeat with i in LISTE_LIGNES
  939.     --    reponse.add(value(CLEANLOWCASE(member("MOBIDATA").text.line[i])))
  940.     reponse.add(value(member("MOBIDATA").text.line[i]))
  941.   end repeat
  942.   ------------------------------------------------------------------------------
  943.   return reponse--ATTENTION RENVOI D'UNE LISTE DE LISTES
  944. end
  945. ----------------
  946. on CLEANLOWCASE CHAINE
  947.   -- cette procΘdure permet de remplacer les minuscules par des majuscules dans une chaine de caractΦres
  948.   reponse = EMPTY--on  remet la pile α zΘro
  949.   FIN = length(CHAINE)
  950.   repeat with i = 1 to FIN
  951.     temp = CHAINE.char[i]
  952.     u = chartoNum(temp)
  953.     case(u>64 and u < 91) of
  954.       1:---------c'est une lettre capitale
  955.         reponse = reponse&temp--on la pile 
  956.       0:
  957.         case(u>96 and u < 123) of
  958.           1: ----------------c'est une bas de casse
  959.             reponse = reponse&numtochar(u - 32)--on pile la majuscule correspondante
  960.           0:-----------------ce n'est pas une lettre
  961.             reponse = reponse&temp--on pile le caractΦre
  962.         end case
  963.     end case
  964.   end repeat
  965.   return reponse
  966. end
  967. -------------------
  968. on diode N-- activation/dΘsactivation des diodes
  969.   -- si N = 1 les diodes sont interactives, si 0 elles sont inhibΘes
  970.   global gL_Zap
  971.   gL_Zap[20] = N
  972. end
  973. ----------------
  974. on ZAP_NAVIG me, NoItem --gΦre la navigation par bouton dans la zapette
  975.   global gL_Zap
  976.   case(NoItem) of
  977.     1,2:--SUITE, RETOUR,
  978.       tell the stage
  979.         goSameRub(localParam("NAV",NoItem))
  980.       end tell 
  981.     3:--DEBUT
  982.       temp =  localParam("NAV",NoItem)
  983.       case(temp) of
  984.         99:
  985.           tell the stage
  986.             goOtherRub("RATOCLIC",0, "ATTENTE")
  987.           end tell
  988.         otherwise:
  989.           tell the stage
  990.             goSameRub(temp) 
  991.           end tell
  992.       end case
  993.     4:--REJOUER
  994.       tell the stage
  995.         go movie("@/"&the movieName)
  996.       end tell
  997.     5:--PAUSE
  998.       case(gL_Zap[10]) of
  999.         0:
  1000.           sprite(me.spriteNum).member = "BTON_GO"
  1001.           tell the stage
  1002.             PAUSE()
  1003.           end tell
  1004.           gL_Zap[10] = 1
  1005.         1:
  1006.           sprite(me.spriteNum).member = "BTON_PAUSE"
  1007.           tell the stage
  1008.             go the frame-- cela dΘbloque la pause
  1009.           end tell
  1010.           gL_Zap[10] = 0
  1011.       end case
  1012.     6:--SOMMAIRE
  1013.       tell the stage
  1014.         goOtherRub("RATOCLIC",0, "ATTENTE")
  1015.       end tell
  1016.   end case
  1017. end
  1018. ---------------
  1019. on ZAP_TOOLS NoItem--gΘre les outils d'aide dans la zapette
  1020.   global gL_Zap, gL_localTEXTES, gL_RetourAide 
  1021.   case(NoItem) of
  1022.     1:--Aide rubrique locale
  1023.       tell the stage
  1024.         if voidP(gL_localTEXTES) then init_localTEXTES
  1025.         if gL_localTEXTES = [] then
  1026.           member("AIDE_RUB").text = EMPTY
  1027.         else
  1028.           temp = gL_localTEXTES.getaProp("_AIDE")
  1029.           member("AIDE_RUB").text = member(COMMENT_TANK()).char[temp[1]..temp[2]]
  1030.         end if
  1031.         member("AIDE_RUB").fontSize = 10 
  1032.         member("AIDE_RUB").scrollTop = 0
  1033.       end tell
  1034.       case(gL_Zap[2]) of
  1035.         0:-- la zapette n'a jamais ΘtΘ ouverte
  1036.           show_zapette()
  1037.           tell gL_Zap[1]
  1038.             go "AIDE_"&gimme2digits(zfamily())
  1039.           end tell
  1040.         1:-- la zapette a dΘjΘ ΘtΘ ouverte et elle est visible
  1041.           tell gL_Zap[1]
  1042.             go "AIDE_"&gimme2digits(zfamily())
  1043.           end tell
  1044.         -1:-- la zapette a dΘjΘ ΘtΘ ouverte et elle est invisible
  1045.           gL_Zap[1].open()
  1046.           tell gL_Zap[1]
  1047.             go "AIDE_"&gimme2digits(zfamily())
  1048.           end tell
  1049.       end case
  1050.     2:--Dico
  1051.       tell the stage
  1052.         if voidP(gL_localTEXTES) then init_localTEXTES
  1053.         if gL_localTEXTES = []  then
  1054.           member("DICO").text = EMPTY
  1055.         else
  1056.           temp = gL_localTEXTES.getaProp("_DICO")
  1057.           member("DICO").text = member(COMMENT_TANK()).char[temp[1]..temp[2]]
  1058.         end if
  1059.         member("DICO").fontSize = 10
  1060.         member("DICO").scrollTop = 0
  1061.       end tell
  1062.       case(gL_Zap[2]) of
  1063.         0:-- la zapette n'a jamais ΘtΘ ouverte
  1064.           show_zapette()
  1065.           tell gL_Zap[1]
  1066.             go "DICO_"&gimme2digits(zfamily())
  1067.           end tell
  1068.         1:-- la zapette a dΘjΘ ΘtΘ ouverte et elle est visible
  1069.           tell gL_Zap[1]
  1070.             go "DICO_"&gimme2digits(zfamily())
  1071.           end tell
  1072.         -1:-- la zapette a dΘjΘ ΘtΘ ouverte et elle est invisible
  1073.           gL_Zap[1].open()
  1074.           tell gL_Zap[1]
  1075.             go "DICO_"&gimme2digits(zfamily())
  1076.           end tell
  1077.       end case
  1078.     3:--Info
  1079.       tell the stage
  1080.         if voidP(gL_localTEXTES) then init_localTEXTES
  1081.         if gL_localTEXTES = [] then
  1082.           member("INFO").text = EMPTY
  1083.         else
  1084.           temp = gL_localTEXTES.getaProp("_INFO")
  1085.           member("INFO").text = member(COMMENT_TANK()).char[temp[1]..temp[2]]
  1086.         end if
  1087.         member("INFO").fontSize = 10 
  1088.         member("INFO").scrollTop = 0
  1089.       end tell
  1090.       case(gL_Zap[2]) of
  1091.         0:-- la zapette n'a jamais ΘtΘ ouverte
  1092.           show_zapette()
  1093.           tell gL_Zap[1]
  1094.             go "INFO_"&gimme2digits(zfamily())
  1095.           end tell
  1096.         1:-- la zapette a dΘjΘ ΘtΘ ouverte et elle est visible
  1097.           tell gL_Zap[1]
  1098.             go "INFO_"&gimme2digits(zfamily())
  1099.           end tell
  1100.         -1:-- la zapette a dΘjΘ ΘtΘ ouverte et elle est invisible
  1101.           gL_Zap[1].open()
  1102.           tell gL_Zap[1]
  1103.             go "INFO_"&gimme2digits(zfamily())
  1104.           end tell
  1105.       end case
  1106.     4:--Sous titrage
  1107.       tell the stage
  1108.         show_COMMENTS()
  1109.       end tell
  1110.     5:--Aide Zapette
  1111.       tell the stage
  1112.         gL_RetourAide = [string(zrub()),zNoSRub()]
  1113.         goOtherRub("AIDE",0)
  1114.       end tell
  1115.   end case
  1116. end 
  1117. ---------------------------------
  1118. on ZAP_MISC NoItem--gΘre les btons MISC dans la zapette
  1119.   global gL_Zap,gL_mobidata,gChoixrub
  1120.   case(NoItem) of
  1121.     1:--bouton Volume Up
  1122.       if gL_Zap[16][9] < 6 then
  1123.         step = gL_Zap[16][9] + 1
  1124.         sprite(gL_Zap[19][3]).member = "VU"&gimme2digits(step)
  1125.         updateStage
  1126.         calcul_nivson(step )
  1127.       end  if
  1128.     2:--bouton Volume Down
  1129.       if gL_Zap[16][9] > 1 then
  1130.         step = gL_Zap[16][9] - 1
  1131.         sprite(gL_Zap[19][3]).member = "VU"&gimme2digits(step)
  1132.         updateStage
  1133.         calcul_nivson(step )
  1134.       end  if
  1135.     3:--pisteVumΦtre
  1136.       nothing
  1137.     4:--bouton coupe musique
  1138.       case(gL_Zap[17]) of
  1139.         1: --la piste musique marche,onla dΘsactive
  1140.           gL_Zap[16][1] = -gL_Zap[16][1]
  1141.           gL_Zap[17] = -1
  1142.           sprite(gL_Zap[19][4]).member = "BTON_MUSIK_ON"
  1143.         -1:--la piste musique est dΘsactivΘe, on la rΘactive
  1144.           gL_Zap[16][1] = -gL_Zap[16][1]
  1145.           gL_Zap[17] = 1
  1146.           sprite(gL_Zap[19][4]).member = "BTON_MUSIK_OFF"
  1147.       end case
  1148.       tell the stage
  1149.         sound(1).volume = gL_Zap[16][1]
  1150.       end tell
  1151.       updateStage
  1152.     5:--bouton print
  1153.       tell the stage
  1154.         imprime()
  1155.       end tell
  1156.     6:--bouton screenshot
  1157.       go "EXPORTJPEG"
  1158.       u = the date
  1159.       mem = the itemDelimiter
  1160.       the itemDelimiter = "/"
  1161.       tampon = "Mobi"&string( zNoMobi())
  1162.       repeat with i = 1 to 2
  1163.         tampon = tampon&u.item[i]
  1164.       end repeat
  1165.       v = the time
  1166.       the itemDelimiter = ":"
  1167.       repeat with i = 1 to 2
  1168.         tampon = tampon&v.item[i]
  1169.       end repeat
  1170.       the itemDelimiter = mem
  1171.       
  1172.       exportEcran("DOCUMENTS",tampon)
  1173.     7:--bouton rubrique prΘcΘdente
  1174.       if voidP(gChoixrub) then gChoixrub = localparam("COORD",2)
  1175.       if gChoixrub > 2 then
  1176.         gChoixrub = gChoixrub - 1
  1177.       else
  1178.         gChoixrub = gL_mobidata[1][5] - 1
  1179.       end if
  1180.       temp = gL_mobidata[3][gChoixrub]
  1181.       u = string(gL_mobidata[2].getPropAt(gChoixrub))
  1182.       if gL_mobidata[1][3].getPos(u) > 0 then -- si la rubrique est dΘsactivΘe
  1183.         sprite(1).member = "logo"&temp&"_OFF"
  1184.       else
  1185.         sprite(1).member = "logo"&temp
  1186.       end if
  1187.       lowjingle(8,"temp","OUT")
  1188.       --      puppetTransition 12,2,1,TRUE
  1189.     8:--bouton rubrique suivante
  1190.       if voidP(gChoixrub) then gChoixrub = localparam("COORD",2)
  1191.       if gChoixrub < gL_mobidata[1][5] -1 then
  1192.         gChoixrub = gChoixrub + 1
  1193.       else
  1194.         gChoixrub = 2
  1195.       end if
  1196.       temp = gL_mobidata[3][gChoixrub]
  1197.       u = string(gL_mobidata[2].getPropAt(gChoixrub))
  1198.       if gL_mobidata[1][3].getPos(u) > 0 then -- si la rubrique est dΘsactivΘe
  1199.         sprite(1).member = "logo"&temp&"_OFF"
  1200.       else
  1201.         sprite(1).member = "logo"&temp
  1202.       end if
  1203.       lowjingle(8,"temp","OUT")
  1204.       --      puppetTransition 11,2,1,TRUE
  1205.     9:-- bouton quitter
  1206.       tell the stage
  1207.         go movie "@//COMMUN/GENERIC"
  1208.       end tell
  1209.   end case
  1210. end 
  1211. ----------
  1212. on gimmeMyFolder
  1213.   temp = the pathName
  1214.   n1 = offset("DATA", temp) + 5
  1215.   n2 = length(temp) - 1
  1216.   return temp.char[n1..n2]
  1217. end
  1218. ---------------------
  1219. on compte_Mots()
  1220.   Nb_acteurs = the number of members of castLib 1
  1221.   compteur = 0
  1222.   repeat with i = 1 to Nb_acteurs
  1223.     ZENOM = member(i).name
  1224.     if ZENOM contains "MOT" and not(ZENOM contains "_R") and not(ZENOM contains "_S") and not(ZENOM contains "_I") then
  1225.       L = length(ZENOM)
  1226.       ZENo = value(ZENOM.char[L-1..L])
  1227.       compteur = max(compteur, ZENo)
  1228.     end if
  1229.   end repeat
  1230.   return compteur
  1231. end
  1232. -------------
  1233. on clic_zap ZETARGET, ZESOUNDTRACK
  1234.   puppetSound ZESOUNDTRACK, 0
  1235.   go ZETARGET
  1236. end
  1237. -------------------
  1238. on printCropEcran ZERECT
  1239.   member("TAMPON_ECRAN").image = the stage.image
  1240.   crop(member("TAMPON_ECRAN"), ZERECT)
  1241.   --  imprimeacteur(member("TAMPON_ECRAN").memberNum,member("TAMPON_ECRAN").castlibNum)
  1242.   printFrom label("PRINT_LABEL")
  1243. end
  1244. -------------------
  1245. on exportPicture ACTEUR, CHEMIN
  1246.   temp = member(ACTEUR).image
  1247.   SaveAsJPEG(temp,CHEMIN,100)
  1248. end
  1249. ------------------
  1250. on exportEcran TARGET,NOMFIC
  1251.   member("TAMPON_ECRAN").picture = the stage.picture
  1252.   pipeline = xtra(XtraVersion("FILEXTRA")).new()
  1253.   case(TARGET) of
  1254.     "BUREAU":
  1255.       case(lien()) of
  1256.         ":":
  1257.           localpath = pipeline.fx_FolderGetSpecialPath("kDesktopFolderType")
  1258.         "\":
  1259.           localpath = pipeline.fx_FolderGetSpecialPath("CSIDL_COMMON_DESKTOPDIRECTORY")
  1260.         otherwise:
  1261.           beep 2
  1262.       end case
  1263.     "DOCUMENTS":
  1264.       case(lien()) of
  1265.         ":":
  1266.           localpath = pipeline.fx_FolderGetSpecialPath("kDocumentsFolderType")
  1267.         "\":
  1268.           localpath = pipeline.fx_FolderGetSpecialPath("CSIDL_PERSONAL")
  1269.         otherwise:
  1270.           beep 2
  1271.       end case
  1272.       
  1273.       
  1274.   end case
  1275.   exportPicture("TAMPON_ECRAN",localpath&NOMFIC&".jpg")
  1276.   pipeline = 0
  1277. end
  1278. --------------------------
  1279. on faire_bonne_impression  WATMODE, WATTYPE,WATSTUFF,TITRE, PIED_DE_PAGE
  1280.   -- WATMODE indique si on est en mode aperτu (1) ou en mode impression (0)
  1281.   -- WATMEDIA indique le type de fichier α imprimer : acteur (nom d'acteur) ou Θcran ("E")
  1282.   -- crΘation d'une instance de l'xtra d'impression----------------------------------------------------------
  1283.   doc = new(xtra "PrintOMatic")
  1284.   if not objectP(doc) then exit
  1285.   -- rΘglages des marges
  1286.   setPrintableMargins (doc)
  1287.   setMargins doc, rect(42,42,42,42)
  1288.   -- crΘation de la page
  1289.   if (doPageSetup(doc)) then
  1290.     newPage doc
  1291.     -- initialisation des variables de format page
  1292.     L_Page=getPageWidth(doc)
  1293.     H_Page=getPageHeight(doc)
  1294.     --initialisation de la police
  1295.     setTextFont doc,"Dream of me *"
  1296.     
  1297.     case(WATTYPE) of
  1298.       "E": --impression d'Θcran
  1299.         
  1300.       "M":--impression d'acteur
  1301.         L = float(member(WATSTUFF).width)
  1302.         H = float(member(WATSTUFF).height)
  1303.         coef  = H/L
  1304.         case(L>=H) of
  1305.           1:
  1306.             L_schema = min(L, L_Page)
  1307.             H_schema = (L_schema)*coef
  1308.           0:
  1309.             H_schema = min(H,H_Page-50)
  1310.             L_schema = H_schema/coef
  1311.         end case
  1312.         drawPicture doc,member(WATSTUFF),rect(0,0,L_schema,H_schema)
  1313.         ----------------- PIED DE PAGE -------------------
  1314.         -- ligne horizontale bas de page
  1315.         --        drawLine doc,point(0,H_Page-30),point(L_Page,H_Page-30)
  1316.         setTextJust doc,"left"
  1317.         setTextStyle doc,"plain"
  1318.         setTextSize doc,16
  1319.         drawText doc,PIED_DE_PAGE,point(L_Page- 255,H_Page-15)
  1320.         -- logo  GF
  1321.         --        drawPicture doc,member("LOGO_MILAN"),rect(L_Page- 41,H_Page-41,L_Page-1,H_Page-1)
  1322.         setTextSize doc,8
  1323.     end case
  1324.     -- lancement de l'impression-----------------------------------------------------------
  1325.     case(WATMODE) of
  1326.       1:-- si on est en mode aperτu on affiche l'aperτu
  1327.         printPreview doc
  1328.       0:-- sinon on imprime
  1329.         setProgressMsg doc, "Impression de la fiche "&TITRE&" en cours... "
  1330.         if doJobSetup(doc) then print doc
  1331.     end case
  1332.   end if
  1333. end
  1334. -----------------------------------
  1335. on faire_bonne_impression2  WATMODE, WATTYPE,WATSTUFF
  1336.   -- WATMODE indique si on est en mode aperτu (1) ou en mode impression (0)
  1337.   -- crΘation d'une instance de l'xtra d'impression----------------------------------------------------------
  1338.   doc = new(xtra "PrintOMatic")
  1339.   if not objectP(doc) then exit
  1340.   -- rΘglages des marges
  1341.   setPrintableMargins (doc)
  1342.   setMargins doc, rect(42,42,42,42)
  1343.   -- crΘation de la page
  1344.   if (doPageSetup(doc)) then
  1345.     newPage doc
  1346.     -- initialisation des variables de format page
  1347.     L_Page=getPageWidth(doc)
  1348.     H_Page=getPageHeight(doc)
  1349.     case(WATTYPE) of
  1350.       "E": --impression d'Θcran
  1351.         
  1352.       "M":--impression d'acteur
  1353.         L = float(member(WATSTUFF).width)
  1354.         H = float(member(WATSTUFF).height)
  1355.         coef  = H/L
  1356.         case(L>=H) of
  1357.           1:
  1358.             L_schema = max(L, L_Page-42)
  1359.             H_schema = (L_schema)*coef
  1360.           0:
  1361.             H_schema = max(H,H_Page-42)
  1362.             L_schema = H_schema/coef
  1363.         end case
  1364.         drawPicture doc,member(WATSTUFF),rect(0,0,L_schema,H_schema)
  1365.     end case
  1366.     -- lancement de l'impression-----------------------------------------------------------
  1367.     case(WATMODE) of
  1368.       1:-- si on est en mode aperτu on affiche l'aperτu
  1369.         printPreview doc
  1370.       0:-- sinon on imprime
  1371.         setProgressMsg doc, "Impression en cours... "
  1372.         if doJobSetup(doc) then print doc
  1373.     end case
  1374.   end if
  1375. end
  1376. ------------------------------------------------------------------------------
  1377. on compte_Famille RACINE_NOM, NoDISTRIB
  1378.   case(the paramCount) of
  1379.     1:
  1380.       Nb_acteurs = the number of members of castLib 1
  1381.     2:
  1382.       Nb_acteurs = the number of members of castLib NoDISTRIB
  1383.   end case
  1384.   
  1385.   reponse = 0
  1386.   repeat with i = 1 to Nb_acteurs
  1387.     if member(i,NoDISTRIB).name contains RACINE_NOM then
  1388.       reponse = reponse + 1
  1389.     end if
  1390.   end repeat
  1391.   return reponse
  1392. end
  1393. --------------------
  1394. on RAZ_pistes_son
  1395.   repeat with i = 2 to 8
  1396.     coupeson(i)
  1397.   end repeat
  1398.   -------------------
  1399. on gimmezeDroite ZE2POINTS
  1400.   x1 = ZE2POINTS[1][1]
  1401.   y1 = ZE2POINTS[1][2]
  1402.   x2 = ZE2POINTS[2][1]
  1403.   y2 = ZE2POINTS[2][2]
  1404.   if abs(x1-x2) < 2 then 
  1405.     x2 = x1
  1406.   else
  1407.     if abs(y1-y2) < 2 then
  1408.       y2 = y1
  1409.     end if
  1410.   end if
  1411.   case(x1<>x2 and y1 <> y2) of
  1412.     1:
  1413.       -- cas gΘnΘral
  1414.       a = float(y2 - y1)/(x2 - x1)
  1415.       b = y1 - a*x1
  1416.       reponse = [a,b]
  1417.     0:
  1418.       case(x1 = x2) of
  1419.         1: --droite verticale
  1420.           
  1421.           reponse = ["V", x1]
  1422.         0: -- droite horizontale
  1423.           reponse = ["H", y1]
  1424.       end case
  1425.   end case
  1426.   return reponse
  1427. end
  1428. ---------------------
  1429. on extractNo LIBELLE
  1430.   --pour un libellΘ de la forme TRUC_ii o∙ ii est un indice α 2 chiffres, renvoie l'indice
  1431.   --ex "MOBI_07" -> 7
  1432.   L = length(LIBELLE)
  1433.   reponse = value(LIBELLE.char[L-1..L])
  1434.   return reponse
  1435. end
  1436. --------------------
  1437. on extractRoot LIBELLE
  1438.   --pour un libellΘ de la forme TRUC_ii o∙ ii est un indice α 2 chiffres, renvoie la racine
  1439.   --ex "MOBI_07" -> "MOBI"
  1440.   --sinon renvoie le libellΘ
  1441.   L = length(LIBELLE)
  1442.   if not(voidP(extractNo(LIBELLE))) and LIBELLE.char[L-2] = "_" then
  1443.     return LIBELLE.char[1..L-3]
  1444.   else
  1445.     return LIBELLE
  1446.   end if
  1447. end
  1448. --------------------
  1449. on localdata
  1450.   case(the paramCount) of
  1451.     1:
  1452.       return value(member("localdata").line[param(1)])
  1453.     2:
  1454.       if param(1) = 0 or param(2) =0 then
  1455.         return EMPTY
  1456.       else
  1457.         if param(2) < param(1) then
  1458.           return EMPTY
  1459.         else
  1460.           reponse = []
  1461.           repeat with i = param(1)  to param(2) 
  1462.             reponse.add(value(member("localdata").line[i]))
  1463.           end repeat
  1464.           return reponse
  1465.         end if
  1466.       end if
  1467.   end case
  1468. end 
  1469. -----------------------
  1470. on jump_intro ZEGOUDLABEL
  1471.   global L_gmemPassage
  1472.   if L_gmemPassage = VOID then L_gmemPassage = []
  1473.   zemoovy_nem = the movieName.char[1..length(the movieName)-4]
  1474.   if L_gmemPassage.getPos(zemoovy_nem) > 0 then
  1475.     go ZEGOUDLABEL
  1476.     spritesMenus()
  1477.     hide_title()
  1478.   else 
  1479.     L_gmemPassage.add(zemoovy_nem)
  1480.   end if
  1481. end
  1482. ---------------------
  1483. on gere_soustitrage ID_SON-- procΘdure lancΘe dans les procΘdures "joueson()"
  1484.   global gL_localTEXTES, gL_Zap
  1485.   if zDumb() = -1 then
  1486.     member("DUMB_COMMENT").text = EMPTY
  1487.   else
  1488.     if voidP(gL_localTEXTES) then
  1489.       init_localTEXTES()
  1490.     else
  1491.       if gL_localTEXTES = 0 then--cas o∙ l'acteur "LOCAL_TEXTES n'a pas ΘtΘ crΘΘ
  1492.         exit
  1493.       else
  1494.         member("DUMB_COMMENT").text = trouve_soustitre(ID_SON)
  1495.         if gL_Zap[23] <> 0 then 
  1496.           tell gL_Zap[24]
  1497.             member("DUMB_COMMENT_BIS").text =  member("DUMB_COMMENT").text
  1498.           end tell
  1499.         end if
  1500.       end if
  1501.     end if
  1502.   end if
  1503. end
  1504. -----------------------
  1505. on init_localTEXTES
  1506.   global gL_localTEXTES
  1507.   fin = the number of members of castLib(1)
  1508.   flag = 0
  1509.   test =  COMMENT_TANK()
  1510.   repeat with i = 1 to fin
  1511.     if member(i).name = test then
  1512.       flag = i
  1513.       L = member(test).line.count
  1514.       gL_localTEXTES = value(member(test).line[L])
  1515.       exit repeat
  1516.     end if
  1517.   end repeat
  1518.   if flag = 0 then gL_localTEXTES = []
  1519.   
  1520. end
  1521. --------------
  1522. on sonrub SON, Nopiste
  1523.   joueson(localparam("COORD",5)&gimme2digits(localparam("COORD",6)-1)&"_"&SON)
  1524.   if the paramCount = 2 then joueson(localparam("COORD",5)&gimme2digits(localparam("COORD",6)-1)&"_"&SON, Nopiste)
  1525. end
  1526. ----------------------
  1527. on trouve_soustitre CHAINE
  1528.   global gL_localTEXTES
  1529.   if gL_localTEXTES <> [] then
  1530.     temp = gL_localTEXTES.getaProp(CLEANLOWCASE(CHAINE))
  1531.   else
  1532.     temp = VOID
  1533.   end if
  1534.   if voidP(temp) then
  1535.     return EMPTY
  1536.   else
  1537.     return member(COMMENT_TANK()).char[temp[1]..temp[2]]
  1538.   end if
  1539. end
  1540. ---------------------------------------------------------
  1541. on calculNolineaire ZELISTE,NoSOUSLISTE, NoELEMENTSOUSLISTE
  1542.   --dans une liste de listes renvoie le n░ linΘaire d'un ΘlΘment d'une des sous-listes
  1543.   temp = 0
  1544.   repeat with i = 1 to NoSOUSLISTE-1
  1545.     temp = temp + count(ZELISTE[i])
  1546.   end repeat
  1547.   return temp + NoELEMENTSOUSLISTE
  1548. end 
  1549. ---------------------------------------------
  1550. on matrix2list NoLIGNE,NoCOLONNE, NbCOLONNES
  1551.   if NoLIGNE < 1 or NoCOLONNE < 1 or NoCOLONNE > NbCOLONNES then
  1552.     return -1
  1553.   else
  1554.     return (NoLIGNE -1)*NbCOLONNES + NoCOLONNE
  1555.   end if
  1556. end
  1557. ---------------------------------------
  1558. on list2matrix No,NbCOLONNES 
  1559.   Q = No/ NbCOLONNES
  1560.   R = No - Q*NbCOLONNES
  1561.   case(No) of:
  1562.     0:
  1563.       return [0,0]
  1564.     otherwise:
  1565.       case(R) of
  1566.         0:
  1567.           return [Q, NbCOLONNES]  
  1568.         otherwise:
  1569.           return [Q + 1, R] 
  1570.       end case
  1571.   end case
  1572. end
  1573. ---------------------------------------
  1574. on moyennepond-- en paramΦtres: des listes [valeur,population associΘe]
  1575.   fin = the paramCount
  1576.   tot = 0
  1577.   totcardinal = 0
  1578.   repeat with i = 1 to fin
  1579.     L= param(i)
  1580.     tot = tot + L[1]*L[2]
  1581.     totcardinal = totcardinal + L[2]
  1582.   end repeat
  1583.   return float(tot)/totcardinal
  1584. end
  1585. ---------------------------------
  1586. on peakzeLOOP SPRITENo, WATMODE
  1587.   case(WATMODE) of
  1588.     "M":
  1589.       temp = sprite(SPRITENo).member.name
  1590.       Nopiste = extractNo(temp)
  1591.       tell sprite(SPRITENo)
  1592.         if sprite(Nopiste) .member.number > 0 then
  1593.           return sprite(Nopiste).member.name 
  1594.         else
  1595.           return "NOP"
  1596.         end if
  1597.       end tell
  1598.     "S":
  1599.       --nothing
  1600.   end case
  1601. end
  1602. ------------------
  1603. on listshake ZELIST -- donne une combinaison alΘatoire d'une liste
  1604.   Nb_Items = count(ZELIST)
  1605.   L_random = randomList(Nb_Items, Nb_Items)
  1606.   L_reponse = []
  1607.   repeat with i = 1 to Nb_Items
  1608.     L_reponse.add(ZELIST[L_random[i]])
  1609.   end repeat
  1610.   return L_reponse
  1611. end
  1612. ------------
  1613. on FIC2MEMBER FICPATH,NOMFICHIER,NOMACTEUR
  1614.   pipeLine = new(xtra"fileio")-- crΘation d'une instance de l'Xtra File IO
  1615.   temp = FICPATH&NOMFICHIER
  1616.   -- test  fichier valide
  1617.   if not voidP(temp) and not (temp = EMPTY) then
  1618.     openFile(pipeLine, temp, 1)--ouverture du fichier
  1619.     if status(pipeLine) = 0 then
  1620.       temp = readFile(pipeLine)
  1621.       member(NOMACTEUR).text = temp
  1622.     else
  1623.       alert error (pipeLine, status(pipeLine))
  1624.     end if
  1625.   end if
  1626.   closeFile(pipeLine)
  1627.   pipeLine = 0
  1628. end
  1629. --------------------------------------------------
  1630. on MEMBER2FIC FICPATH,NOMFICHIER,NOMACTEUR
  1631.   pipeLine = new(xtra"fileio")-- crΘation d'une instance de l'Xtra File IO
  1632.   --
  1633.   fileName = FICPATH&NOMFICHIER
  1634.   -- crΘe le fichier
  1635.   createFile (pipeLine, filename)
  1636.   -- ouvre le fichier
  1637.   openFile (pipeLine, filename, 0)
  1638.   --dΘtruit le fichier deja existant
  1639.   delete(pipeLine)
  1640.   -- crΘe le fichier
  1641.   createFile (pipeLine, filename)
  1642.   -- ouvre le fichier
  1643.   openFile (pipeLine, filename, 0)
  1644.   -- Θcriture de l'acteur
  1645.   pipeLine.writeString(member(NOMACTEUR).text)
  1646.   -- fermeture
  1647.   closeFile(pipeLine)  
  1648.   pipeLine = 0
  1649. end
  1650. --------------------------------------
  1651. on MAJ_userlist MODE,MAX
  1652.   global gNb_users
  1653.   member("USERS_LIST").text = EMPTY
  1654.   case (member("USERS_TANK").text = EMPTY) of
  1655.     1:------------------------------ si le container est vide
  1656.       gNb_users = 0 
  1657.       member("USERS_LIST").text = EMPTY
  1658.     0:------------------------------ si le container n'est pas vide
  1659.       the floatPrecision = 2
  1660.       gNb_users = member("USERS_TANK").line.count
  1661.       case(the paramCount) of
  1662.         0:--aucun paramΦtre, par dΘfaut α la maniΦre du QUIZ--------------------------------------------
  1663.           repeat with i = 1 to  gNb_users
  1664.             temp = value(member("USERS_TANK").line[i])
  1665.             temp1 = temp[1]
  1666.             temp2 = float(temp[2][1])/temp[2][2]
  1667.             if temp2 = 10.00 then
  1668.               the floatPrecision = 0
  1669.               member("USERS_LIST").line[i] = temp1&TAB&string(temp2*10)&&"%"
  1670.               the floatPrecision = 2
  1671.             else
  1672.               the floatPrecision = 2
  1673.               member("USERS_LIST").line[i] = temp1&TAB&string(temp2*10)&&"%"
  1674.             end if
  1675.           end repeat
  1676.         1:--1 paramΦtre
  1677.           case(MODE) of
  1678.             "NOP":--on affiche seulement le nom suivi du rΘsultat brut
  1679.               repeat with i = 1 to  gNb_users
  1680.                 temp = value(member("USERS_TANK").line[i])
  1681.                 temp1 = temp[1]
  1682.                 temp2 = temp[2][1]
  1683.                 member("USERS_LIST").line[i] = temp1&TAB&string(temp2)
  1684.               end repeat
  1685.             "B":--on affiche les meilleurs scores
  1686.               repeat with i = 1 to  gNb_users
  1687.                 temp = value(member("USERS_TANK").line[i])
  1688.                 temp1 = temp[1]
  1689.                 temp2 = temp[2][5]--meilleur score actuel
  1690.                 temp3 = temp[2][1]--score de la partie
  1691.                 zebest = max(temp2,temp3)
  1692.                 member("USERS_LIST").line[i] = temp1&TAB&string(temp2)
  1693.               end repeat
  1694.             otherwise:
  1695.               
  1696.           end case
  1697.         2:--2 paramΦtres
  1698.           case(MODE) of:
  1699.             "SURCENT":--------en pourcentage sur l'ensemble des joueurs
  1700.               repeat with i = 1 to  gNb_users
  1701.                 temp = value(member("USERS_TANK").line[i])
  1702.                 temp1 = temp[1]
  1703.                 temp2 = temp[2][1]*100/MAX
  1704.                 member("USERS_LIST").line[i] = temp1&TAB&string(temp2)&"/100"
  1705.               end repeat
  1706.           end case
  1707.       end case
  1708.   end case
  1709. end
  1710. ------------
  1711. on gimme_userList USER_FIC,CONTAINER
  1712.   global glocalBUpath
  1713.   case(lien()) of
  1714.     ":":
  1715.       pipeline = xtra(XtraVersion("FILEXTRA")).new()
  1716.       glocalBUpath = pipeline.fx_FolderGetSpecialPath("kDocumentsFolderType")
  1717.     "\":
  1718.       pipeline = xtra(XtraVersion("FILEXTRA")).new()
  1719.       --      glocalBUpath = baSysFolder("desktop")
  1720.       glocalBUpath = pipeline.fx_FolderGetSpecialPath("CSIDL_PERSONAL")
  1721.   end case
  1722.   
  1723.   ------------------------- on teste la prΘsence du dossier des datas des MOBICLIC
  1724.   temp = pipeline.Fx_FolderExists(glocalBUpath&"MOBICLIC")
  1725.   case(temp) of
  1726.     1:-- si le dossier existe on teste la prΘsence du fichier utilisateur actuel
  1727.       temp = pipeline.Fx_FileExists(glocalBUpath&"MOBICLIC"&lien()&USER_FIC&".txt")
  1728.       case(temp) of
  1729.         1:--si le fichier utilisateur existe on le charge
  1730.           FIC2MEMBER(glocalBUpath&"MOBICLIC"&lien(),USER_FIC&".txt",CONTAINER)
  1731.         0:--s'il n'existe pas on le crΘe vierge
  1732.           temp = pipeline.Fx_FileCopy(the moviepath&lien()&"TEMPLATE.txt",glocalBUpath&"MOBICLIC"&lien()&USER_FIC&".txt") 
  1733.           FIC2MEMBER(glocalBUpath&"MOBICLIC"&lien(),USER_FIC&".txt",CONTAINER)
  1734.       end case
  1735.     0:-- si le dossier n'existe pas on le crΘe ainsi que le fichier user vierge
  1736.       temp = pipeline.Fx_FolderCreate(glocalBUpath&"MOBICLIC")
  1737.       temp = pipeline.Fx_FileCopy(the moviepath&lien()&"TEMPLATE.txt",glocalBUpath&"MOBICLIC"&lien()&USER_FIC&".txt")
  1738.       FIC2MEMBER(glocalBUpath&"MOBICLIC"&lien(),USER_FIC&".txt",CONTAINER)
  1739.   end case
  1740.   pipeline  = 0
  1741. end
  1742. --------------------
  1743. on test_user
  1744.   global gNb_users, gUserName
  1745.   flag = 0
  1746.   repeat with i = 1 to gNb_users
  1747.     if  value(member("USERS_TANK").line[i])[1] = gUserName then
  1748.       flag = 1
  1749.       exit repeat
  1750.     end if
  1751.   end repeat
  1752.   case(flag) of
  1753.     0:-- si le nom n'a pas dΘja ΘtΘ utilisΘ
  1754.       return "OK"
  1755.     1:--si le nom a dΘja ΘtΘ utilisΘ
  1756.       return "KO"
  1757.   end case
  1758. end
  1759. ----------------------------------------
  1760. on delete_user MODE
  1761.   global gNb_users, gNo_item, glocalBUpath,gScore_NomFic
  1762.   L = []
  1763.   repeat with i = 1 to gNb_users
  1764.     if i <> gNo_item then L.add(value(member("USERS_TANK").line[i]))
  1765.   end repeat
  1766.   member("USERS_LIST").text = EMPTY
  1767.   member("USERS_TANK").text = EMPTY
  1768.   if L <> [] then
  1769.     fin = count(L)
  1770.     repeat with i = 1 to fin
  1771.       if i = 1 then
  1772.         member("USERS_TANK").text = string(L[1])
  1773.         member("USERS_LIST").text = string(L[1][1])
  1774.       else
  1775.         member("USERS_TANK").text = member("USERS_TANK").text&RETURN&string(L[i])
  1776.         member("USERS_LIST").text = member("USERS_LIST").text&RETURN&string(L[i][1])
  1777.       end if
  1778.     end repeat
  1779.   end if
  1780.   gNb_users = gNb_users -1
  1781.   --enregistrement de la modif sur le disque dur
  1782.   case(the paramCount) of
  1783.     0:
  1784.       MEMBER2FIC(glocalBUpath&"MOBICLIC"&lien(),"M"&string(zNoMobi())&string(zRub())&".txt","USERS_TANK")
  1785.     1:
  1786.       case(param(1)) of
  1787.         "SCORE":
  1788.           MEMBER2FIC(glocalBUpath&"MOBICLIC"&lien(),gScore_NomFic&".txt","USERS_TANK")
  1789.         otherwise:
  1790.       end case
  1791.   end case
  1792. end
  1793. ----------------------------------
  1794. on save_rubrik USER_FIC ,CONTAINER, NOM, STUFF2RECORD
  1795.   global  gNb_users, glocalBUpath
  1796.   N = 0
  1797.   case(member(CONTAINER).text = EMPTY) of
  1798.     1:
  1799.       member(CONTAINER).text = string([NOM, STUFF2RECORD])
  1800.     0:
  1801.       repeat with i = 1 to gNb_users
  1802.         if  value(member(CONTAINER).line[i])[1] = NOM then
  1803.           N = i
  1804.           exit repeat
  1805.         end if
  1806.       end repeat
  1807.       case(N) of 
  1808.         0:
  1809.           member(CONTAINER).line[gNb_users + 1] = string([NOM, STUFF2RECORD])
  1810.         otherwise:
  1811.           member(CONTAINER).line[N] = string([NOM, STUFF2RECORD])
  1812.       end case
  1813.   end case
  1814.   MEMBER2FIC(glocalBUpath&"MOBICLIC"&lien(),USER_FIC&".txt",CONTAINER)
  1815. end
  1816. ----------------------
  1817. on MAJ_SCORE NOM, LIST2SAVE,MODE
  1818.   global gScore_NomFic,gModeScore
  1819.   -----------------------------on sauvegarde les paramΦtres joueurs
  1820.   case(the paramCount) of
  1821.     2:--ancienne mΘthode(1fichier par RUBRIQUE pour un numΘro)
  1822.       save_rubrik("M"&string(zNoMobi())&string(zRub()) ,"USERS_TANK",NOM,LIST2SAVE)
  1823.     3:-------------------------nouvelle mΘthode(1fichier par SOUS_RUBRIQUE pour un numΘro)
  1824.       save_rubrik(gScore_NomFic,"USERS_TANK",NOM,LIST2SAVE)
  1825.   end case
  1826.   zRub_UserList("SCORE") -- on recharge les paramΦtres joueurs
  1827.   case(the paramCount) of
  1828.     2:
  1829.       MAJ_Userlist() -- on met α jour la liste des joueurs et leurs scores
  1830.     3:
  1831.       MAJ_Userlist(MODE)
  1832.   end case
  1833. end
  1834. -----------------------
  1835. on XtraVersion XTRANAME
  1836.   case(XTRANAME) of
  1837.     "FILEXTRA":
  1838.       case(lien()) of
  1839.         ":":
  1840.           return "FileXtra4"
  1841.         "\":
  1842.           return "FileXtra4"
  1843.       end case
  1844.     otherwise
  1845.       --
  1846.   end case
  1847. end
  1848. -----------
  1849. on creationRepertoires
  1850.   rdm = field "repDuMois"
  1851.   case the machineType of
  1852.     256 : -- la machine est un PC --------------------------------------------------------
  1853.       repertoire = baSysFolder("windows") & "MilanPresse"
  1854.       OK = baFolderExists(repertoire)
  1855.       if OK=0 then
  1856.         -- toute l'arborescence doit Ωtre crΘΘe
  1857.         baCreateFolder(repertoire)
  1858.         repMilan = the PathName & "Install\MilanPresse"
  1859.         XCopyDirectory(repMilan,repertoire)
  1860.       else
  1861.         -- le rΘpertoire Mobiclic est-il prΘsent ?
  1862.         repertoire = baSysFolder("windows") & "MilanPresse\Mobiclic"
  1863.         OK = baFolderExists(repertoire)
  1864.         if OK=0 then
  1865.           baCreateFolder(repertoire)
  1866.           repMobi = the PathName & "Install\MilanPresse\Mobiclic"
  1867.           XCopyDirectory(repMobi,repertoire)
  1868.         else
  1869.           -- le rΘpertoire du mois est-il prΘsent ?
  1870.           repertoire = baSysFolder("windows") & "MilanPresse\Mobiclic\" & rdm
  1871.           OK = baFolderExists(repertoire)
  1872.           if OK=0 then
  1873.             -- crΘation du rΘpertoire du mois
  1874.             repertoire = baSysFolder("windows") & "MilanPresse\Mobiclic"
  1875.             repMilan = the PathName & "Install\MilanPresse\Mobiclic"
  1876.             XCopyDirectory(repMilan,repertoire)
  1877.           end if
  1878.         end if
  1879.       end if
  1880.       
  1881.     otherWise : -- la machine est un Mac -------------------------------------------------
  1882.       repertoire = baSysFolder("prefs") & "MilanPresse"
  1883.       OK = baFolderExists(repertoire)
  1884.       if OK=0 then
  1885.         -- toute l'arborescence doit Ωtre crΘΘe
  1886.         baCreateFolder(repertoire)
  1887.         repMilan = the PathName & "Install:MilanPresse"
  1888.         XCopyDirectory(repMilan,repertoire)
  1889.       else
  1890.         -- le rΘpertoire Mobiclic est-il prΘsent ?
  1891.         repertoire = baSysFolder("prefs") & "MilanPresse:Mobiclic"
  1892.         OK = baFolderExists(repertoire)
  1893.         if OK=0 then
  1894.           baCreateFolder(repertoire)
  1895.           repMobi = the PathName & "Install:MilanPresse:Mobiclic"
  1896.           XCopyDirectory(repMobi,repertoire)
  1897.         else
  1898.           -- le rΘpertoire du mois est-il prΘsent ?
  1899.           repertoire = baSysFolder("prefs") & "MilanPresse:Mobiclic:" & rdm
  1900.           OK = baFolderExists(repertoire)
  1901.           if OK=0 then
  1902.             -- crΘation du rΘpertoire du mois
  1903.             repertoire = baSysFolder("prefs") & "MilanPresse:Mobiclic"
  1904.             repMilan = the PathName & "Install:MilanPresse:Mobiclic"
  1905.             XCopyDirectory(repMilan,repertoire)
  1906.           end if
  1907.         end if
  1908.       end if
  1909.   end case
  1910. end
  1911. ----------------------------
  1912. on miseAtaille NOPISTE,IMAGE, WMAX, HMAX
  1913.   W = member(IMAGE).width
  1914.   H = member(IMAGE).height
  1915.   if W < WMAX and H < HMAX then
  1916.     sprite(NOPISTE).member = IMAGE
  1917.     sprite(NOPISTE).width = W
  1918.     sprite(NOPISTE).height = H
  1919.   else
  1920.     if W >H then
  1921.       k = W/float(H)
  1922.       H1 = WMAX/k
  1923.       if H1 <= HMAX then
  1924.         wfinal = WMAX
  1925.         hfinal = H1 
  1926.       else
  1927.         hfinal = HMAX
  1928.         wfinal = HMAX*k
  1929.       end if
  1930.       sprite(NOPISTE).member = IMAGE
  1931.       sprite(NOPISTE).width = wfinal
  1932.       sprite(NOPISTE).height = hfinal
  1933.     else
  1934.       k = H/float(W)
  1935.       W1 = HMAX/k
  1936.       if W1 <= WMAX then
  1937.         wfinal = W1
  1938.         hfinal = HMAX
  1939.       else
  1940.         wfinal = WMAX
  1941.         hfinal = WMAX*k
  1942.       end if
  1943.       sprite(NOPISTE).member = IMAGE
  1944.       sprite(NOPISTE).width = wfinal
  1945.       sprite(NOPISTE).height = hfinal
  1946.     end if
  1947.   end if
  1948.   tds(NOPISTE,"ON")
  1949. end
  1950.  
  1951. -------------------------------------------
  1952. on miseAtailleSTAMP NOPISTE,IMAGE, WMAX, HMAX
  1953.   W = member(IMAGE).width
  1954.   H = member(IMAGE).height
  1955.   if W < WMAX and H < HMAX then
  1956.     sprite(NOPISTE).member = IMAGE
  1957.   else
  1958.     if W >H then
  1959.       k = W/float(H)
  1960.       H1 = WMAX/k
  1961.       if H1 <= HMAX then
  1962.         wfinal = WMAX
  1963.         hfinal = H1 
  1964.       else
  1965.         hfinal = HMAX
  1966.         wfinal = HMAX*k
  1967.       end if
  1968.       sprite(NOPISTE).member = IMAGE
  1969.       sprite(NOPISTE).width = wfinal
  1970.       sprite(NOPISTE).height = hfinal
  1971.     else
  1972.       k = H/float(W)
  1973.       W1 = HMAX/k
  1974.       if W1 <= WMAX then
  1975.         wfinal = W1
  1976.         hfinal = HMAX
  1977.       else
  1978.         wfinal = WMAX
  1979.         hfinal = WMAX*k
  1980.       end if
  1981.       sprite(NOPISTE).member = IMAGE
  1982.       sprite(NOPISTE).width = wfinal
  1983.       sprite(NOPISTE).height = hfinal
  1984.     end if
  1985.   end if
  1986.   
  1987. end
  1988. --------------------------------
  1989.